<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title>会员列表</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script src="__PUBLIC__/static/layui/layui.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<!--右侧内容-->
					<div class="rigtop">
						<span class="title">消费会员</span>
					</div>
					<div class="indrig_con" style="position: relative;">
						<div class="zizh_btnbox" style="top: -58px; right: 20px;">
							<button class="zizh_btn" type="button" onclick="promotion_add()"><i class="iconfont icon-jia"></i>创建会员</button>
						</div>
						<div class="zizh_conbox" style="padding-top: 20px;">
							<!--选项卡内容开始-->
							<div class="zizh_con_1">
								<form id="my_form" action="{:url('accounts/promotion_user')}" method="post">
									<div class="shxx_row chax_row clearfix">
										<div class="left">加入时间：</div>
										<div class="right clearfix">
											<div class="layui-inline">
												<div class="layui-input-inline">
													<input type="text" class="layui-input" name="begin_time" id="begin_time" placeholder="yyyy年MM月dd日">
												</div>
											</div>
											<i class="chax_line"></i>
											<div class="layui-inline">
												<div class="layui-input-inline">
													<input type="text" class="layui-input" name="end_time" id="end_time" placeholder="yyyy年MM月dd日">
												</div>
											</div>
										</div>
									</div>
									<div class="chax_rowbox clearfix">
										<div class="shxx_row clearfix">
											<div class="left">会员编号：</div>
											<div class="right clearfix">
												<input type="text" name="member_no" placeholder="会员编号" class="chax_input" />
											</div>
										</div>
										<div class="shxx_row clearfix">
											<div class="left">手机号：</div>
											<div class="right clearfix">
												<input type="text" name="mobile" placeholder="" class="chax_input" />
											</div>
										</div>
									</div>
									<div class="chax_rowbox clearfix spfl_topbox">
										<div class="shxx_row clearfix">
											<span class="level_flbt">会员等级：</span>
											<a href="{:url('agent/accounts/promotion_user')}"><span class="level_fl active">全部</span></a>
											{volist name="$user_level" id="vo"}
											<a href="{:url('agent/accounts/promotion_user',['level_id'=>$vo.id])}"><span class="level_fl">{$vo.level_name}</span></a>
											{/volist}
										</div>
										<div class="shxx_row clearfix">
											<button type="button" id='to_user_levle' class="htcxbtn fenlcx_btn">+会员等级</button>
											<button type="submit" onclick="return check_time()" class="htcxbtn">搜索</button>
										</div>
									</div>
									</from>
									<div class="chax_conbox">
										<div class="chax_jiegbt clearfix">
											<div class="chax_jieg">会员总计：{$list->total();}</div>
											<div class="chax_xzbtnbox">
												<a href="#"><i class="iconfont icon-daoru"></i>导入</a>
												<a href="#"><i class="iconfont icon-daochu"></i>导出</a>
											</div>
										</div>
										<div class="chax_jiegnr">
											<table class="zizh_table1">
												<thead>
													<tr>
														<th class="w_20">会员卡号</th>
														<th class="w_20">姓名</th>
														<th class="w_10">手机号</th>
														<th class="w_10">状态</th>
														<th class="w_10">余额</th>
														<th class="w_10">会员等级</th>
														<th class="w_10">注册时间</th>
														<th class="w_20">操作</th>
													</tr>
												</thead>
												<tbody id="tbody">
													{volist name="$list" id="vo" empty="这里没有数据"}
													<tr>
														<td>{$vo.member_no}</td>
														<td>{$vo.member_name}</td>
														<td>{$vo.mobile}</td>
														<td>
															{if $vo.state==1 } 正常 {else} 冻结 {/if}
														</td>
														<td>{$vo.balance}</td>
														<td>{$vo.level_name}</td>
														<td>{$vo.add_time}</td>
														<td>
															<a>编辑</a>
															<a class="gray">解冻</a>
														</td>
													</tr>
													{/volist}

												</tbody>
											</table>
											<div class="fenye" style="display: block;">
												{$list->render()}
											</div>
										</div>
									</div>
							</div>
						</div>

					</div>
				</div>
			</div>
		</div>
		{include file="public/footer" /}

	</body>

</html>
<script>
	layui.use('laydate', function() {
		var laydate = layui.laydate;

		//日期控件
		laydate.render({
			elem: '#begin_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});

		laydate.render({
			elem: '#end_time',
			type: 'datetime',
			format: 'yyyy-MM-dd HH:mm:ss'
		});
	})

	//时间区间
	function check_time() {
		var begin_time = $('#begin_time').val();
		var end_time = $('#end_time').val();
		if(begin_time.length > 2 || end_time.length > 2) {

			if(begin_time.length < 2 || end_time.length < 2) {
				layer.msg("请输入查询时间区间");
				return false;
			}

		}
	}

	//会员等级
	$('#to_user_levle').click(function() {
		location.href = "user_level.html";
	})

	//新增会员
	function promotion_add() {
		layer.open({
			type: 2,
			title: '添加会员',
			shadeClose: true,
			shade: 0.8,
			area: ['900px', '740px'],
			content: "{:url('accounts/member_add')}"
		});
	}
</script>